<?php
// +---------------------------------------------------------------------+
// | OneBase    | [ WE CAN DO IT JUST THINK ]                            |
// +---------------------------------------------------------------------+
// | Licensed   | http://www.apache.org/licenses/LICENSE-2.0 )           |
// +---------------------------------------------------------------------+
// | Author     | Bigotry <3162875@qq.com>                               |
// +---------------------------------------------------------------------+
// | Repository | https://gitee.com/Bigotry/OneBase                      |
// +---------------------------------------------------------------------+

namespace app\admin\controller;

use app\common\model\GamblerKing;

/**
 * 赌王产品控制器
 */
class Investment extends AdminBase
{

    /**
     * 资讯头条赌王产品列表
     */
    public function investmentList()
    {
        $this->param['type']=1;
        $this->assign('list', $this->logicinvestment->getinvestmentList($this->param, 'a.*', 'a.create_time desc'));
        $this->assign('type',1);
        $this->assign('param', $this->param);
        return $this->fetch('investment_list');
    }



    /**
     * 赌王产品添加
     */
    public function investmentAdd()
    {

        $this->investmentCommon();

        return $this->fetch('investment_edit');
    }

    /**
     * 赌王产品编辑
     */
    public function investmentEdit()
    {

        $this->investmentCommon();

        $info = $this->logicinvestment->getinvestmentInfo(['a.id' => $this->param['id']], 'a.*');



        $this->assign('info', $info);
        $cate=GamblerKing::all(['status'=>1]);
        $this->assign('article_category_list', $cate);
        return $this->fetch('investment_edit');
    }


    /**
     * 赌王产品列表
     */
    public function investmentList1()
    {


        $this->param['type']=2;
        $this->assign('list', $this->logicinvestment->getinvestmentList( $this->param, 'a.*', 'a.create_time desc'));

        $this->assign('param', $this->param);
        $this->assign('type',2);

        return $this->fetch('investment_list');
    }


    /**
     * 赌王产品添加与编辑通用方法
     */
    public function investmentCommon()
    {

        IS_POST && $this->jump($this->logicinvestment->investmentEdit($this->param));

        if(empty($this->param['type'])){
            $this->param['type']=1;
        }
        $this->assign('param',  $this->param);

    }



    /**
     * 数据状态设置
     */
    public function setStatus()
    {

        $this->jump($this->logicAdminBase->setStatus('GamblerKingInvestment', $this->param));
    }


    /**
     * 数据状态设置
     */
    public function update_info()
    {

        $this->jump($this->logicinvestment->update_info($this->param));
    }

}
